<?php
require("inc/common.inc.php");
if ($adtype=="" || empty($adtype)){
  $adshow=""; 
}
else{
  $sql="select type,adcode from qh_ad where adtype='$adtype' and yz='1' order by posttime desc,id desc limit 0,1";
  $rs=$db->excu($sql);
  if ($db->num_rows($rs)<=0){
    $adshow=""; 
  }
  else{
    $rsdb=mysql_fetch_array($rs);
	@extract(unserialize($rsdb[adcode]));
	$code=stripslashes($code);
	if ($rsdb[type]=="word"){
      $adshow="<a href='$linkurl' ";
	  if ($pictarget=="blank"){$adshow.=" target='_blank' ";}
      $adshow.=">$word</a>";
	}
	elseif ($rsdb[type]=="pic"){
      $adshow="<a href='$linkurl' ";
	  if ($pictarget=="blank"){$adshow.=" target='_blank' ";}
      $adshow.="><img src='".get_photourl($picurl)."' width='$width' height='$height' border=0 /></a>";
	}
	elseif ($rsdb[type]=="swf"){
      $adshow="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='$width' height='$height'><param name='movie' value='".get_photourl($flashurl)."' /><param name='quality' value='high' /><param name='wmode' value='transparent'><embed wmode='transparent' quality='high'></embed> <embed src='".get_photourl($flashurl)."' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='$width' height='$height'></embed></object>";
	
	}
	elseif ($rsdb[type]=="code"){
      $adshow="$code";
	}
  }
}

?>
document.write("<?php echo $adshow;?>");
